<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <title>Document</title>
    <script type="text/javascript" src = "{{asset('/js/jquery-1.8.3.min.js')}} ">

    </script>
    <meta name="csrf-token" content="{{ csrf_token() }}">
</head>
<body>
    <button id = btn"">点击</button>
    <script type="text/javascript">
        // alert($);
        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });

        $("button").on('click',function(){
            $.ajax({
                url:"{{url('/ajax')}}",
                type:"POST",
                success:function(data){
                    alert(data);
                },
                error:function(){
                    alert('失败');
                }

            });
        });
    </script>
</body>
</html>